﻿using System.Collections.Generic;
using System.Linq;
using AB.ServiceDirectory.Commons.DataFilters;
using AB.ServiceDirectory.Dao;
using AB.ServiceDirectory.Entities;

namespace AB.ServiceDirectory.BO
{
    public static class HungContactBO
    {
        private static readonly HungContactDao Dao = new HungContactDao();

        /// <summary>
        /// Selects the contact by id.
        /// </summary>
        /// <param name="contactId">The contact id.</param>
        /// <returns></returns>
        public static Contact SelectContactById(int contactId)
        {
            return HungContactDao.SelectContactById(contactId);
        }

        /// <summary>
        /// Selects all contact types.
        /// </summary>
        /// <returns></returns>
        public static ICollection<ContactType> SelectAllContactTypes()
        {
            return HungContactDao.SelectAllContactTypes().ToList();
        }

        /// <summary>
        /// Selects all best thod contact.
        /// </summary>
        /// <returns></returns>
        public static ICollection<BestContactMethod> SelectAllBestMethodContact()
        {
            return HungContactDao.SelectAllBestMethodContacts().ToList();
        }

        /// <summary>
        /// Gets the list.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <param name="sortType">Type of the sort.</param>
        /// <param name="startRowIndex">Start index of the row.</param>
        /// <param name="maxRows">The max rows.</param>
        /// <returns></returns>
        public static ICollection<Contact> GetList(HContactFilter filter, string sortType, int startRowIndex,
                                                   int maxRows)
        {
            return HungContactDao.GetList(filter, sortType, startRowIndex, maxRows).ToList();
        }

        /// <summary>
        /// Gets the list count.
        /// </summary>
        /// <param name="filter">The filter.</param>
        /// <returns></returns>
        public static int GetListCount(HContactFilter filter)
        {
            return HungContactDao.GetListCount(filter);
        }

        /// <summary>
        /// Inserts the contact.
        /// </summary>
        /// <param name="contact">The contact.</param>
        /// <returns></returns>
        public static bool InsertContact(Contact contact)
        {
            return Dao.InsertContact(contact);
        }

        /// <summary>
        /// Updates the contact.
        /// </summary>
        /// <param name="contact">The contact.</param>
        /// <returns></returns>
        public static bool UpdateContact(Contact contact)
        {
            return Dao.UpdateContact(contact);
        }
    }
}